package com.mck.mapper;

import com.mck.entity.Subject;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SubjectMapper {
    /**
     * 获取科目列表
     */
    @Select("select * from subjects")
    List<Subject> getSubjectList();

    /**
     * 获取指定id科目
     */
    @Select("SELECT * FROM subjects WHERE id = #{id}")
    Subject selectById(Integer id);

    /**
     * 获取ids科目
     */
    // List<Subject> selectByIds(List<Integer> ids);

    /**
     * 添加科目
     */
    @Insert("insert into subjects (subject) values (#{subject})")
    void addSubject(Subject subject);

    /**
     * 删除科目
     */
    @Delete("delete from subjects where id = #{id}")
    void deleteSubject(Integer id);
}
